from substrateinterface import SubstrateInterface, Keypair

def getKey(key):

    substrate = SubstrateInterface(
        url="ws://127.0.0.1:9944",
        ss58_format=42,
        type_registry_preset='substrate-node-template'
    )

    result = substrate.query(
        module='SimpleEvent',
        storage_function='Map',
        params=[key]
    )
    #print(result.value)
    return {
        "code":200,
        "value":result.value
    }

#print(result.value['nonce']) #  7695
#print(result.value['data']['free']) # 635278638077956496
